﻿toggle = function (fsid)
{
    var div = $id("div_" + fsid);
    var lnkdscd = $id("lnkdscd__lov_" + fsid);
    var lnkedit = $id("lnkedit__lov_" + fsid);
    var display = "";
    
    if( div.style.display != "none" )
    {
        display = "none";
    }
    
    div.style.display = display;
    if(lnkdscd != null)
    {
        lnkdscd.style.display = display;
    }
    if(lnkedit != null)
    {
        lnkedit.style.display = display;
    }
}

DoSave = function()
{
    if(confirm("Simpan konfirmasi?"))
    {
        var hf = $id("hfSave");
        hf.InnerHTML = "SAVE";
        dgCustomerList_c.PerformCallback("SAVE");
    }
}
DoSubmitConfirm = function()
{
    var load = $id("load");

    if(confirm("Submit konfirmasi?"))
    {
        load.innerHTML = "<img src='" + LOADING.src + "' alt='' />"; 
        cbkConfirm_c.PerformCallback("CONFIRM");
    }
}
DoSubmitReason = function(invID)
{
//ambil data
    var reason = $id("lovh_UFT.REASON").value;
    //alert(reason);
    if(confirm("Simpan alasan?"))
    {
        cbkConfirm_c.PerformCallback("SUBMIT" + DELIMITER + invID + DELIMITER + reason);        
    }
}
dgCustomerList_c_CallbackComplete = function(e)
{
    var hf = $id("hfSave");
    if(hf.InnerHTML == "SAVE")
    {
        //var checkall = $id("lnkCheckAll");
        //var uncheck = $id("lnkUncheckAll");
        //var btn = $id("btnSave");
        //btn.style.display = "none";
        //checkall.style.display = "none";
        //uncheck.style.display = "none";
    }
}
checkAll = function()
{
    dgCustomerList_c.SelectAllRowsOnPage();
}
uncheckAll = function()
{
    dgCustomerList_c.UnselectAllRowsOnPage();
}
Reason = function()
{
    //do nothing
}
cbkConfirm_c_CallbackComplete = function(e)
{
    if( e.parameter.startsWith("REASON") )
    {
        var div = $id("popuplayer");
        div.innerHTML = e.result;
    }
    else if( e.parameter.startsWith("SUBMIT"))
    {
        var div = $id("popuplayer");
        div.innerHTML = "";
        div.style.display = "none";
        dgCustomerList_c.PerformCallback("REFRESH");
    }
	else if( e.parameter.startsWith("CONFIRM"))
    {
        window.location = "UFTList.aspx?mode=submitted";
    }
}
DoReason = function(invId)
{
    var div = $id("popuplayer");
    div.style.display = "block";
    div.innerHTML = "<img src='" + LOADING.src + "' alt='' />";
    renderFirst();
    
    cbkConfirm_c.PerformCallback("REASON" + DELIMITER + invId);
}

closeReason = function()
{
    var div = $id("popuplayer");
    div.innerHTML = "";
    div.style.display = "none";
}